home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12447 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
  2. From: grantp@usa.pipeline.com(Pete Grant)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Operator overload problem!
  5. Date: 20 Mar 1996 01:22:15 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4inmk7$9ac@news1.h1.usa.pipeline.com>
  8. References: <DoIn1z.Gou@latcs1.lat.oz.au>
  9. NNTP-Posting-Host: 38.8.53.2
  10. X-PipeUser: grantp
  11. X-PipeHub: usa.pipeline.com
  12. X-PipeGCOS: (Pete Grant)
  13. X-Newsreader: Pipeline v3.5.0
  14.  
  15. On Mar 19, 1996 13:05:58 in article <Operator overload problem!>,
  16. 'boylesgj@lion.cs.latrobe.edu.au (Gregary J Boyles)' wrote: 
  17.  
  18.  
  19. >I am trying to overload the << but I get the syntax errors : friends must
  20. be  
  21. >functions or 
  22. >classes, 'ostream' cannot start a parameter declaration,
  23. 'Address::operator  
  24. ><<(int &,Address &)' 
  25. >must be declared at the first set of astericks and declaration syntax
  26. error at  
  27. >the second set. 
  28. >What the #$%& is it on about? I copied the operator overload function
  29. directly  
  30. >out of a program 
  31. >which compiles and runs so why all of a sudden won't the bloody compiler
  32. accept  
  33. >it? 
  34. > [... code deleted ...] 
  35.  
  36. You need to #include <iostream.h> so that the compiler knows 
  37. what ostream is. 
  38.  
  39. -- 
  40. Pete Grant 
  41. Kalevi, Inc. 
  42. Software Engineering & development
  43.